package com.wgworkshop.pems.common.enums;

/**
 * 性别枚举。
 * Created by wlc on 2017/7/2.
 */
public enum GenderEnum {
    MALE('M'), FEMALE('F');

    private final char code;

    GenderEnum(char code) {
        this.code = code;
    }

    public static GenderEnum fromCode(char code) {
        if (code == 'M') {
            return MALE;
        }
        if (code == 'F') {
            return FEMALE;
        }
        throw new UnsupportedOperationException("The code " + code + " is not supported.");
    }

    public char getCode() {
        return code;
    }
}
